<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

Route::get('/',"IndexController@index");
Route::get("/reg","LoginController@reg");

Route::post("/reg","LoginController@regStore");

Route::get("/regCheck","LoginController@regCheck");

Route::post("/regCheck","LoginController@checkPass");

Route::get("/login","LoginController@login");



Route::post("/login","LoginController@checkLogin");
Route::get("/logout","LoginController@logout");

Route::post("/phoneLogin","LoginController@phoneLogin");

Route::post("/phoneCheck","LoginController@phoneCheck");

Route::get("/user/{user}","UserController@index");

Route::get("/address","UserController@address");

Route::get("/add/address","UserController@addressAdd");

Route::post("/add/address","UserController@addressAddCheck");
Route::post("/changeAddress","UserController@changeAddress");
Route::post("/delAddress/{address}","UserController@delAddress");
Route::get("/editAddress/{address}","UserController@editAddress");
Route::post("/editAddress/{address}","UserController@editAddressCheck");

Route::get("/goods/{goods}","GoodsController@show");

Route::get("/goodsSku","GoodsController@sku");

Route::group(['middlemare'=>'auth:user'],function(){
    Route::post('/goodsCar','GoodsCarController@check');
    Route::get('/goodsCar','GoodsCarController@carlist');

    Route::post('/updateGoodsCar','GoodsCarController@update');

    Route::post('/jiesuan','GoodsCarController@jiesuan');
});

Route::group(["prefix"=>"admin"],function (){
    Route::get("/login","AdminController@login");
    Route::post("/login","AdminController@loginCheck");

    Route::group(["middleware"=>"auth:admin"],function(){
        Route::get("/index","AdminController@index");
        Route::get("/logout","AdminController@logout");
		Route::get("/welcome","AdminController@welcome");
		Route::get("/userlist","AdminController@userlist");
		Route::post("/delUser/{user}","AdminController@delUser");
        Route::post("/delUserAll","AdminController@delUserAll");

        Route::resource('cates', 'CateController');
        Route::post("cates/deleteAll","CateController@destroyAll");

        Route::resource('norms', 'NormController');

        Route::post("norms/deleteAll","NormController@destroyAll");

        Route::resource("goods", "GoodsController");

        Route::get("kucun/{goods}","GoodsController@editKucun");

        Route::post("editKucun","GoodsController@editKucunStore");

        Route::get("setkucun/{goods}","GoodsController@setKucun");

        Route::post("setKucunStore/{goods}","GoodsController@setKucunStore");

        Route::get("img/{goods}","GoodsController@image");

        Route::post("upimg/{goods}","GoodsController@uploadeImage");

        Route::resource("banners", "BannerController");
    });
});
